<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/common.jspf" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>

</head>
<script type="text/javascript">
    $(function() {
        $('#dg').datagrid({
            url:'${proPath}/employee/selectPage.action',
            columns:[[
                {checkbox: true},
                {field:'usercode',title:'登录账号(工号)',width:100},
                {field:'employeeName',title:'姓名',width:100},
                {field:'employeeCompany',title:'总公司',width:100,
                    formatter: function(value,row,index){
                        var array = '${applicationScope.sysParamMap.employee_company}';
                        return valueToText(array,value);
                    }},
                {field:'employeeShop',title:'店铺名称',width:100,
                    formatter: function(value,row,index){
                        var array = '${applicationScope.sysParamMap.employee_shop}';
                        return valueToText(array,value);
                    }},
                {field:'employeeJob',title:'职务',width:100,
                    formatter: function(value,row,index){
                        var array = '${applicationScope.sysParamMap.employee_job}';
                        return valueToText(array,value);
                    }},
                {field:'employeeStatus',title:'角色',width:100,
                    formatter: function(value,row,index){
                        var array = '${applicationScope.sysParamMap.employee_status}';
                        return valueToText(array,value);
                    }}
            ]],
            fitColumns:true,
            singleSelect:true,
            striped:true,
            rownumbers:true,
            pagination:true,
            pageSize:15,
            pageList:[3,6,9,12,15],
            toolbar: [{
                iconCls: 'icon-back',
                text:'返回',
                handler: function(){
                    parent.$('#win').window('close');
                }
            },'-',{
                iconCls: 'icon-add',
                text:'确认角色',
                handler: function(){
                    var oldWin = parent.$("iframe[title='角色管理']").get(0).contentWindow;//返回ifram页面文档（window)
                    var oldrow =oldWin.$('#dg').datagrid("getSelected");
                    var newrow =$('#dg').datagrid("getSelections");
                    $.post("${proPath}/role/rolesetemp.action",
                        {
                            emprole:oldrow.roleName,
                            empcode:newrow.usercode,
                        },
                        function(data){
                            $('#dg').datagrid('reload');
                        });
                }
            },'-',{
                iconCls: 'icon-remove',
                text:'移除角色',
                handler: function(){
                    var oldWin = parent.$("iframe[title='角色管理']").get(0).contentWindow;//返回ifram页面文档（window)
                    var oldrow =oldWin.$('#dg').datagrid("getSelected");
                    var newrow =$('#dg').datagrid("getSelected");
                    $.post("${proPath}/role/rolesetemp.action",
                        {
                            empcode:newrow.usercode,
                            emprole:-1,
                        },
                        function(data){
                            $('#dg').datagrid('reload');
                        });
                }
            }]
        });
    });
</script>
<body>
<!-- 右键菜单定义如下： -->

<table id="dg"></table>

</body>
</html>